using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace Yunwei.Domain.Models.Mapping
{
    public class VendorIngredientMap : EntityTypeConfiguration<VendorIngredient>
    {
        public VendorIngredientMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Name)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Cost)
                .IsRequired();

            this.Property(t => t.Price)
                .IsRequired();

            this.Property(t => t.Unit)
                .IsRequired()
                .HasMaxLength(20);

            // Table & Column Mappings
            this.ToTable("VendorIngredient");

            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Cost).HasColumnName("Cost");
            this.Property(t => t.Price).HasColumnName("Price");
            this.Property(t => t.Stock).HasColumnName("Stock");
            this.Property(t => t.Name).HasColumnName("Name");
            this.Property(t => t.Unit).HasColumnName("Unit");
            this.Property(t => t.Vendor_Id).HasColumnName("Vendor_Id");
            this.Property(t => t.Avatar).HasColumnName("Avatar");
            this.Property(t => t.Description).HasColumnName("Description");
        }
    }
}
